// pages/join/join.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        // data:[
        //     {title:'🚀按时吃早饭',img:'https://th.bing.com/th/id/R971b4ea55fb73978f8c931f1f56e6d48?rik=%2bWfVmMpAyt1dQQ&riu=http%3a%2f%2fwww.dnzhuti.com%2fuploads%2fallimg%2f180424%2f95-1P424154139-50.jpg&ehk=G88sdzcGyc%2fcpXtC%2fi5ePehlk5AUicgawaZ4HxtS2Cs%3d&risl=&pid=ImgRaw',
        //     personNum:85,id:1,des:"早起的鸟儿有虫吃",
        // },
        //     {title:'晨跑一整年🎽',img:'https://th.bing.com/th/id/R1f6c5a1873b4f24e4eb0907be278850a?rik=Dors8AKwF8mhzQ&riu=http%3a%2f%2fn.sinaimg.cn%2fsports%2fcrawl%2f96%2fw550h346%2f20190513%2fcadc-hwsffzc7948129.jpg&ehk=N8as4DePM4KAkPFfiJ8FOkYrDA8lTwcoXnBLlrGDp%2fM%3d&risl=&pid=ImgRaw',
        //     personNum:152,id:2,des:"运动就是力量",
        // }]
    },
    // 跳转到小组详情页
    toJoin:function(res){
        var index = res.currentTarget.dataset.index;
        var id = this.data.data[index].id;
        // 跳转页面携带ID和未加入标志
        wx.navigateTo({
          url: '../dynamic/dynamic?id='+id+'&flag=false',
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var that = this;
        var app = getApp();
        wx.request({
          url: 'http://127.0.0.1:8000/allGroups?openid='+app.globalData.openid,
          success:function(res){
              console.log(res)
              that.setData({
                  data:res.data.data
              })
          }
        })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})